<?php
   	include_once "../funciones.php";
        include_once "../validacionPHP/validacion.php";
    validar($_REQUEST);

    $con=conectar();
  	$fallo=false;
   try {
        $con->beginTransaction();
        $OID=getOIDNuevo('ESCUELAS', 'OID_ESC');

        $sql="INSERT INTO ESCUELAS VALUES  (".$OID.", '".$_REQUEST['DEPORTE']."', '".$_REQUEST['DESCRIPCION']."', '".$_REQUEST['CIF']."')";
        $stmt = $con->prepare($sql);
        $stmt->execute();
		$stmt = $con->prepare("commit");
	    $stmt->execute();

	}catch(PDOException $e ) {
			echo "error: ".$e->GetMessage();
            $con->rollBack();
             header( 'Location: insertarEscuelas.php?exito=2');
   	        $fallo=true;

	}
    if($fallo==false)
        header( 'Location: insertarEscuelas.php?exito=1');


   ?>